// 图层树z-tree  setting
var onlinelayersetting = {
    callback: {
        onClick: layerTreeOnClick,
        onCheck: layerTreeOnCheck
    },
    check: {
        autoCheckTrigger: true,
        enable: true,//显示复选框
        chkStyle: "checkbox"
    },
    key: {
        name: "name",
        title: "name"
    },
    async: {
        enable: true,//要开启async功能必须设置为true,其他地方同理
        dataType: "json",
        type: "get",
        url: "../../js/layer.json"
    },
    data: {
        // key: {
        //     name: "layerName"
        // },
        simpleData: {
            enable: true,
            idKey: "id",//节点id名
            pIdKey: "parentId",//父节点id名
            rootPId: 0//默认根节点为0
        }
    }
};

zTreeNodes = [];
$.fn.zTree.init($("#onlinelayertree"), onlinelayersetting, zTreeNodes);

// z-tree选取事件
function layerTreeOnCheck(event, treeId, treeNode) {
    if (treeNode.checked){
        addOnlineLayer(treeNode.fun);
    }else if (!treeNode.checked){
        removeOnlineLayer(treeNode.fun)
    }
}
function layerTreeOnClick(event, treeId, treeNode) {
    //预定飞行跳转角度
}

